package MIPS;

public class Mips {
    private Operate op;

    public Mips(Operate op) {
        this.op = op;
    }

    public Operate getOp() {
        return op;
    }

    public String opToString() {
        return op.op;
    }

    public enum Operate {
        //directives
        GLOBAL(".word"),
        ASCII(".asciiz"),
        DATA(".data"),
        TEXT(".text"),
        SYSCALL("syscall"),
        //三元
        ADDI("addi"),
        ADDU("addu"),
        SUBI("subi"),
        SUBU("subu"),
        MULI("mult"),
        SLL("sll"),
        SLT("slt"),
        SLTI("slti"),
        SLTIU("sltiu"),
        XOR("xor"),
        MOD("mod"),
        DIV("div"),
        SW("sw"),
        LW("lw"),
        BEQ("beq"),
        BNE("bne"),
        //二元
        LA("la"),
        LI("li"),
        MOVE("move"),
        //一元
        JAL("jal"),
        JR("jr"),
        J("j"),
        MFHI("mfhi"),
        MFLO("mflo"),
        DEF("def"),
        ARRAY("arr"),
        VAL("const"),
        VAR("var"),
        ASSIGN("="),
        FUNC("func"),
        CALL("call"),
        PUSH("push"),
        PRINT("printf"),
        LABEL("label"),
        GETINT("getint()"),
        CMP("CMP"),
        RET("ret");

        private final String op;

        private Operate(String op) {
            this.op = op;
        }
    }
}
